<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1、字面量方式创建，json方式创建
        var obj = {};
        console.log(obj);
        
        var student = {
            name : 'zhansgan',
            age : 23,
            study : function() {
                console.log(this.name +"正在学习");
            }
        }; 
        student.gender = '男';
        student.show = function() {
            console.log(this.name + ": show");
        }
        console.log(student.gender);
        student.study();
        student.show();
        console.log(student);


        //2、构造函数创建对象
        function Animal() {
            this.name = 'kitty';
            this.age = 23;
            this.run = function() {
                console.log(this.name + ' 正在跑步');
            }
        }
        var cat = new Animal();
        cat.run();
    </script>
</body>
</html>